<include file="Public:head" title='模板详情' />
<script src="__PUBLIC__/js/other/validate.js"></script>
<script>
    $(function(){
        $.getScript("__PUBLIC__/js/plugins/kind2/kindeditor-min.js", function() {
            KindEditor.basePath = '__PUBLIC__/js/plugins/kind2/';
            KindEditor.create('textarea[id="details"]');
        });
    })

        </script>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('Modals/lists')}">模板管理</a></li>
                    <li class="active">模板列表</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">模板{$Think.get.id|getPageType}</h3>
                                <form id="form" enctype="multipart/form-data" method="POST" action="{:U('Modals/detail_post')}" onsubmit="return checkJsForm()">
                                    <div class="caption">
                                        <table class="table table_detail">
                                            <tr>
                                                <td class="td_left">标题</td>
                                                <td>
                                                    <input type="text" value="{$detail.name}" name="name" id="name" autocomplete="off"/>
                                                    <if condition="$detail.id gt 0"><a href="http://www.sucaihuo.com/templates/{$detail.id}.html" target="_blank">详情页</a>
                                                        <a href="{$detail.id|getModalsDemo}" target="_blank">演示页</a>
                                                        <a onclick="getMiddleLogo('{$detail.id}',1)">缩略图</a>{$detail.height}
                                                    </if>  
                                                </td>
                                            </tr>

                                            <foreach name="modals_cat" item="row">
                                                <tr class="modals_cat">
                                                    <td class="td_left">
                                                        <label class='label_width'>
                                                            <input type='checkbox' value='{$row.id}'class="cat_id" name='cat_id[]' autocomplete="off" {$detail.cat_id|getChecked=###,$row[id]}>
                                                            {$row.name}
                                                        </label>
                                                    </td>
                                                    <td>

                                                        <table>

                                                            <tr>
                                                            <foreach name="row['sub']" item="row2">
                                                                <td>
                                                                    <label class='label_width'>
                                                                        <input type='checkbox' value='{$row2.id}' class='cat_sub_id' name='cat_sub_id[]' autocomplete="off" {$detail.cat_sub_id|getChecked=###,$row2[id]}>
                                                                        {$row2.name}
                                                                    </label>
                                                                </td>
                                                            </foreach>
                                                </tr>
                                        </table>              
                                        </td>
                                        </tr>
                                        </foreach>
                                        <tr>
                                            <td class="td_left">颜色</td>
                                            <td>
                                        <foreach name="modals_color" item="row">
                                            <label class='label_width'>
                                                <input type='checkbox' value='{$row.id}' name='modal_color_id[]' {$detail.color_id|getChecked=###,$row['id']} autocomplete="off">
                                                {$row.name}
                                            </label>
                                        </foreach>
                                        </td>
                                        </tr>
                                        <tr>
                                            <td class="td_left">布局</td>
                                            <td>
                                        <foreach name="modals_lay" item="row">
                                            <label class='label_width'>
                                                <input type='radio' value='{$row.id}' name='modal_lay_id' {$detail.lay_id|getEqual=###,$row['id'],'checked'} autocomplete="off">
                                                {$row.name}
                                            </label>
                                        </foreach>
                                        </td>
                                        </tr>
                                        <tr>
                                            <td class="td_left">语言</td>
                                            <td>
                                        <foreach name="modals_lang" item="row">
                                            <label class='label_width'>
                                                <input type='radio' value='{$row.id}' name='modal_lang_id' {$detail.lang_id|getEqual=###,$row['id'],'checked'} autocomplete="off">
                                                {$row.name}
                                            </label>
                                        </foreach>
                                        </td>
                                        </tr>
                                                          <tr>
                    <td class="td_left">上传封面图</td>
                    <td>
                        <a id="big_img_area">
                            <if condition="$detail.logo_big neq ''">
                                <a class="fancybox_img" title="{$detail.name}" href="__APP__/{$detail.logo_big}">
                                <img src="__APP__/{$detail.logo_big}" alt="封面图" class="cover_img" id="cover_img" style="max-height: 250px"/>
                                </a>
                                <else/>
                                <img src="__PUBLIC__/images/cover.jpg" alt="封面图" class="cover_img" id="cover_img"/>
                            </if>
<!--                            <input name="logo_big" value="{$detail.logo_big}" type="hidden" autocomplete="off"/>-->
                        </a>
                        <a class="cover_btn" id="cover_btn_big"><span>+</span></a>
                        <span class="tip" style="margin:30px 0 0;display: inline-block">建议760*980px的图片。宽高不限</span>  
                    </td>
                </tr>
                                        <tr>
                                            <td class="td_left">上传源文件</td>
                                            <td>
                                                <a id="zips_area">
<!--                                                    <input id="zip_input"  value='{$detail.zip}' type="text" style="background:#ddd;width:350px;margin:20px 16px 0 0" disabled="disabled" autocomplete="off"/>-->
                                                </a>
                                                <a class="cover_btn" id="zip_btn"><span>+</span></a>
                                                <span class="tip">根目录必须含有“index.html”否则无法演示不能通过审核。</span>  
                                                <input type="hidden" name="zip" id="zip" autocomplete="off" value='{$detail.zip}'/>
                                        <if condition="$detail.zip neq ''"><a href="__APP__/{$detail.zip}">点击下载</a></if>
                                        </td>
                                        </tr>
                                                  <include file="Public:uploads_original" />


                                        <tr>
                                            <td class="td_left">来源</td>
                                            <td>
                                                <input type="text" value="{$detail.source}" placeholder="http://www.sucaihuo.com" name="source" autocomplete="off"/>
                                                <span class="tip">链接地址如：“http://www.sucaihuo.com”</span>  
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="td_left">演示地址</td>
                                            <td>
                                                <input type="text" value="{$detail.url_demo}" name="url_demo" autocomplete="off"/>

                                            </td>
                                        </tr>

                                        <tr>
                                            <td class="td_left">标签:<a onclick="addTags()">+添加标签</a></td>
                                            <td id="td_tags"> 
                                        <foreach name="tags" item="row">
                                            <input name="tag[]" type="text" class="common_txt tag" autocomplete="off" value="{$row}"/><a onclick=$(this).prev('input').remove();
                                                                                                                                         $(this).remove()>删除</a>
                                        </foreach>
                                        </td>
                                        </tr>
                                        </table>
                                    </div>
                                    <div class="course">
                                        <table class="table table_detail" id="table_course">

                                            <tr>
                                                <td class="td_left">状态</td>
                                                <td>

                                                    <label>
                                                        <input class="ace" type="radio"  name="is_check" value='0' {$detail.is_check|getEqual=###,0,'checked'} autocomplete='off'/>
                                                        <span class="lbl"> 关闭</span>
                                                    </label>
                                                    <label>
                                                        <input class="ace" type="radio"  name="is_check" value='1' {$detail.is_check|getEqual=###,1,'checked'} autocomplete='off'/>
                                                        <span class="lbl"> 开启</span>
                                                    </label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">是否推荐</td>
                                                <td>

                                                    <label>
                                                        <input class="ace" type="radio"  name="is_recommend" value='0' {$detail.is_recommend|getEqual=###,0,'checked'} autocomplete='off'/>
                                                        <span class="lbl"> 否</span>
                                                    </label>
                                                    <label>
                                                        <input class="ace" type="radio"  name="is_recommend" value='1' {$detail.is_recommend|getEqual=###,1,'checked'} autocomplete='off'/>
                                                        <span class="lbl"> 是</span>
                                                    </label>
                                                </td>
                                            </tr>
  <tr>
                                                <td class="td_left">详情页开头</td>
                                                <td>
                                                    <textarea class="textarea" name="content_first" id="content_first" autocomplete="off">{$detail.content_first}</textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">关键字</td>
                                                <td>
                                                    <textarea class="textarea" name="keywords" id="keywords" autocomplete="off">{$detail.keywords}</textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">描述</td>
                                                <td>
                                                    <textarea class="textarea" name="description" id="description" autocomplete="off">{$detail.description}</textarea>
                                                </td>
                                            </tr>
                                               <tr>
                                                <td class="td_left">详细说明</td>
                                                <td>
                                                    <textarea class="textarea" name="details" id="details" autocomplete="off" style="height:300px">{$detail.details}</textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left"></td>
                                                <td>
                                                    <input type='hidden' name='id' value='{$Think.get.id}'/>
                                                    <button class="btn btn-info btn-sm" type="submit">
                                                        <i class="icon-ok bigger-110 "></i>
                                                        保 存
                                                    </button>
                                                    <button class="btn btn-sm reset" type="button" onclick="goUrl(-1)">
                                                        <i class="icon-undo bigger-110"></i>
                                                        返 回
                                                    </button>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>
<include file="Public:foot" />
<div class="modal fade" id="modal_cat" data-id="0" data-modal="position"  tabindex="-1" role="dialog" aria-labelledby="modal_catLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" ></h4>
            </div>
            <div class="modal-body">
                名称：
                <input id="cat_name" type="text" class="common_txt" value="{$detail.ord}" maxlength="20" autocomplete="off"/>
            </div>
            <div class="modal-footer">
                <button class="btn btn-danger btn-xs ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" role="button" aria-disabled="false" >
                    <span class="ui-button-text">
                        <i class="icon-trash bigger-110"></i>
                        确 定
                    </span>
                </button>
                <button class="btn btn-xs ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false" data-dismiss="modal">
                    <span class="ui-button-text">
                        <i class="icon-remove bigger-110"></i>
                        取 消
                    </span>
                </button>

            </div>
        </div>
    </div>
</div>
<include file="Uploads:plupload" />
<link rel="stylesheet" href="__PUBLIC__/css/uploads.css" type="text/css" /> 

<script type="text/javascript" src="__PUBLIC__/js/plugins/jquery.dragsort-0.5.2.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/plugins/textarea_autoheight.js"></script>
<script type="text/javascript" src="__APP__/other/js/uploads.js"></script>
<script type="text/javascript">
                                                        $(function() {
                                                            $(".modals_cat").find(".cat_sub_id").click(function() {

                                                                var length_check = $(this).parents(".modals_cat").find(".cat_sub_id:checked").length;
                                                                if (length_check > 0) {
                                                                    $(this).parents(".modals_cat").find(".cat_id").prop("checked", true)
                                                                } else {
                                                                    $(this).parents(".modals_cat").find(".cat_id").removeAttr("checked")
                                                                }
                                                            })
                                                        });





</script>
<script type="text/javascript">
                                                        $(function() {
                                                            getTagAutocomplete();
                                                        });
                                                        function getTagAutocomplete() {
                                                            $(".tag").autocomplete({
                                                                source: "__APP__/{$Think.MODULE_NAME}/Ajax/autocomplete/mtype/2",
                                                                minLength: 1
                                                            });
                                                        }
                                                        function addTags() {
                                                            var tr = "<input name='tag[]' type='text' class='common_txt tag'  value=''/>\n\
<a onclick=$(this).prev('input').remove();$(this).remove()>删除</a>";
                                                            $('#td_tags').append(tr);
                                                            getTagAutocomplete();
                                                        }
                                                        function removeContent(obj) {
                                                            obj.parent("td").parent("tr").remove();
                                                        }
                                                        function addParameter(obj) {
                                                            var tr = "<tr><td class='td_left'>参数设置 <a onclick=addParameter($(this))>+增加</a></td>\n\
    <td><label>参数：</label><input type='text' name='paras[]' class='paras'/>\n\
        <label>描述：</label><input type='text' name='descriptions[]' class='descriptions'/>\n\
        <label>默认：</label><input type='text' name='defaults[]' class='defaults'/>\n\
        <label>链接：</label><input type='text' name='urls[]' class='urls'/>\n\
        <a onclick=removeContent($(this))>删除</a></td></tr>";
                                                            obj.parent("td").parent("tr").after(tr);
                                                        }
</script>
<style>
    #td_tags .common_txt,#form .paras{width:150px}
</style>
